﻿namespace GeoWeb.Demo.DataContext
{
    using System;
    using GeoWeb.DataContext;


    /// <summary>
    /// 表名：DemoTable 主键列：Demo_ID
    /// </summary>
    [SerializableAttribute()]
    public partial class DemoTable : Entity
    {

        protected Int32 _Demo_ID;

        protected String _Demo_Name;

        protected String _Demo_Info;

        public Int32 Demo_ID
        {
            get
            {
                return this._Demo_ID;
            }
            set
            {
                this.OnPropertyValueChange(_.Demo_ID, _Demo_ID, value);
                this._Demo_ID = value;
            }
        }

        public String Demo_Name
        {
            get
            {
                return this._Demo_Name;
            }
            set
            {
                this.OnPropertyValueChange(_.Demo_Name, _Demo_Name, value);
                this._Demo_Name = value;
            }
        }

        public String Demo_Info
        {
            get
            {
                return this._Demo_Info;
            }
            set
            {
                this.OnPropertyValueChange(_.Demo_Info, _Demo_Info, value);
                this._Demo_Info = value;
            }
        }

        /// <summary>
        /// 获取实体对应的表名
        /// </summary>
        protected override Table GetTable()
        {
            return new Table<DemoTable>("DemoTable");
        }

        /// <summary>
        /// 获取实体中的标识列
        /// </summary>
        protected override Field GetIdentityField()
        {
            return _.Demo_ID;
        }

        /// <summary>
        /// 获取实体中的主键列
        /// </summary>
        protected override Field[] GetPrimaryKeyFields()
        {
            return new Field[] {
                        _.Demo_ID};
        }

        /// <summary>
        /// 获取列信息
        /// </summary>
        protected override Field[] GetFields()
        {
            return new Field[] {
                        _.Demo_ID,
                        _.Demo_Name,
                        _.Demo_Info};
        }

        /// <summary>
        /// 获取列数据
        /// </summary>
        protected override object[] GetValues()
        {
            return new object[] {
                        this._Demo_ID,
                        this._Demo_Name,
                        this._Demo_Info};
        }

        /// <summary>
        /// 给当前实体赋值
        /// </summary>
        protected override void SetValues(IRowReader reader)
        {
            if ((false == reader.IsDBNull(_.Demo_ID)))
            {
                this._Demo_ID = reader.GetInt32(_.Demo_ID);
            }
            if ((false == reader.IsDBNull(_.Demo_Name)))
            {
                this._Demo_Name = reader.GetString(_.Demo_Name);
            }
            if ((false == reader.IsDBNull(_.Demo_Info)))
            {
                this._Demo_Info = reader.GetString(_.Demo_Info);
            }
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }

        public override bool Equals(object obj)
        {
            if ((obj == null))
            {
                return false;
            }
            if ((false == typeof(DemoTable).IsAssignableFrom(obj.GetType())))
            {
                return false;
            }
            if ((((object)(this)) == ((object)(obj))))
            {
                return true;
            }
            return false;
        }

        public class _
        {

            /// <summary>
            /// 表示选择所有列，与*等同
            /// </summary>
            public static AllField All = new AllField<DemoTable>();

            /// <summary>
            /// 字段名：Demo_ID - 数据类型：Int32
            /// </summary>
            public static Field Demo_ID = new Field<DemoTable>("Demo_ID");

            /// <summary>
            /// 字段名：Demo_Name - 数据类型：String
            /// </summary>
            public static Field Demo_Name = new Field<DemoTable>("Demo_Name");

            /// <summary>
            /// 字段名：Demo_Info - 数据类型：String
            /// </summary>
            public static Field Demo_Info = new Field<DemoTable>("Demo_Info");
        }
    }
}
